<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // 求某个数的阶乘
        function factorial(n) {
            var mul = 1;
            for (var i = 1; i <= n; i++) {
                mul *= i;
            }
            return mul;
        }
        // 判断某个数各个数位的阶乘之和是否和该数相等，相等则判断为喇叭花数，并将该数返回
        function islabahuashu(n) {
            var ge = n % 10;
            var shi = parseInt(n / 10) % 10;
            var bai = parseInt(n / 100);
            var sum = factorial(ge) + factorial(shi) + factorial(bai);
            if (sum == n) {
                return console.log(n);
            }
        }
        // 循环遍历三位数的数字，依次判断是否为喇叭花数
        for (var i = 100; i <= 999; i++) {
            islabahuashu(i);
        }
    </script>
</head>
<body>
    
</body>
</html>